const { Sequelize } = require('sequelize');
const config = {
  host: "localhost",
  database: "medical2",
  username: "root",
  password: "",
  port: 3306
}
const sequelize = new Sequelize( //实例
  config.database,
  config.username,
  config.password,
  {
    host: config.host,
    dialect: "mysql",
    pool: {
      max: 5,//最大连接池连接数量
      min: 0,
      idle: 10000,//如果一个线程10秒内没被使用则释放
    },
    logging: true,//
  }
)
const UserModel = require('./model/user')(sequelize)
const StaffModel = require('./model/staff')(sequelize)
const BackupModel = require('./model/backup')(sequelize)
const TransportModel = require('./model/transport')(sequelize)
const WasteInfoModel = require('./model/wasteInfo')(sequelize)
const StageModel = require('./model/stage')(sequelize)
const ReceiveModel = require('./model/receive')(sequelize)

module.exports = {//导出
  sequelize,
  UserModel,
  StaffModel,
  BackupModel,
  TransportModel,
  WasteInfoModel,
  StageModel,
  ReceiveModel
}
